Mechanism for obtaining and applying constraints to constructs within an interactive environment

ABSTRACT

The present mechanism obtains constraints within an interactive environment, associates these constraints with constructs, and then applies these constraints to the constructs when encountering the constructs. The constraints may be saved in metadata associated with the respective construct. The constraints may specify a data type for the construct, a predicate directive, a documentation directive, a parsing directive, a data generation directive, a data validation directive, or an object processing and encoding directive. The constraints are extendable to support other directives. The mechanism allows interactive users to easily specify constraints interactively.

TECHNICAL FIELD

Subject matter disclosed herein relates to interactive environments, andin particular to obtaining and applying constraints within aninteractive environment.

BACKGROUND OF THE INVENTION

In general, there are two types of code: compiled code and interpretedcode. In the past, compiled code was compiled into an object code andthen linked with other object codes to create an executable that wasexecuted at run-time. Today, in some environments, compiled codeincludes source code that has been compiled into an intermediate form.At run-time, the intermediate form is compiled into native code forexecution. In either of these scenarios, a developer may specify a typefor each construct programmed in the source code. Types include integer,string, float, and the like. In contrast, for interpreted code within aninteractive environment, the interactive environment processes eachvariable as a string. Therefore, interactive users may not specify thetype for a variable.

Therefore, there is a need for a mechanism for assigning types and otherconstraints to variables in an interactive environment.

SUMMARY OF THE INVENTION

The present mechanism obtains constraints within an interactiveenvironment, associates these constraints with constructs, and thenapplies these constraints to the constructs when encountering theconstructs. The constraints may be saved in metadata associated with therespective construct. The constraints may specify a data type for theconstruct, a predicate directive, a documentation directive, a parsingdirective, a data generation directive, a data validation directive, oran object processing and encoding directive. The constraints areextendable to support other directives. The mechanism allows interactiveusers to easily specify constraints interactively.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 illustrates an exemplary computing device that may use anexemplary administrative tool environment.

FIG. 2 is a block diagram generally illustrating an overview of anexemplary administrative tool framework for the present administrativetool environment.

FIG. 3 is a block diagram illustrating components within thehost-specific components of the administrative tool framework shown inFIG. 2.

FIG. 4 is a block diagram illustrating components within the core enginecomponent of the administrative tool framework shown in FIG. 2.

FIG. 5 is one exemplary data structure for specifying a cmdlet suitablefor use within the administrative tool framework shown in FIG. 2.

FIG. 6 is an exemplary data structure for specifying a command base typefrom which a cmdlet shown in FIG. 5 is derived.

FIG. 7 is another exemplary data structure for specifying a cmdletsuitable for use within the administrative tool framework shown in FIG.2.

FIG. 8 is a logical flow diagram illustrating an exemplary process forhost processing that is performed within the administrative toolframework shown in FIG. 2.

FIG. 9 is a logical flow diagram illustrating an exemplary process forhandling input that is performed within the administrative toolframework shown in FIG. 2.

FIG. 10 is a logical flow diagram illustrating a process for processingscripts suitable for use within the process for handling input shown inFIG. 9.

FIG. 11 is a logical flow diagram illustrating a script pre-processingprocess suitable for use within the script processing process shown inFIG. 10.

FIG. 12 is a logical flow diagram illustrating a process for applyingconstraints suitable for use within the script processing process shownin FIG. 10.

FIG. 13 is a functional flow diagram illustrating the processing of acommand string in the administrative tool framework shown in FIG. 2.

FIG. 14 is a logical flow diagram illustrating a process for processingcommands strings suitable for use within the process for handling inputshown in FIG. 9.

FIG. 15 is a logical flow diagram illustrating an exemplary process forcreating an instance of a cmdlet suitable for use within the processingof command strings shown in FIG. 14.

FIG. 16 is a logical flow diagram illustrating an exemplary process forpopulating properties of a cmdlet suitable for use within the processingof commands shown in FIG. 14.

FIG. 17 is a logical flow diagram illustrating an exemplary process forexecuting the cmdlet suitable for use within the processing of commandsshown in FIG. 14.

FIG. 18 is a functional block diagram of an exemplary extended typemanager suitable for use within the administrative tool framework shownin FIG. 2.

FIG. 19 graphically depicts exemplary sequences for output processingcmdlets within a pipeline.

FIG. 20 illustrates exemplary processing performed by one of the outputprocessing cmdlets shown in FIG. 19.

FIG. 21 graphically depicts an exemplary structure for displayinformation accessed during the processing of FIG. 20.

FIG. 22 is a table listing an exemplary syntax for exemplary outputprocessing cmdlets.

FIG. 23 illustrates results rendered by the out/console cmdlet usingvarious pipeline sequences of the output processing cmdlets.

DETAILED DESCRIPTION

Briefly stated, the present mechanism obtains constraints within aninteractive environment and then applies these constraints to constructsentered within the interactive environment. The constraints may be savedin metadata associated with the respective construct. The constraintsmay specify a data type for the construct, a valid range for theconstruct, and the like. The mechanism allows interactive users toeasily specify constraints interactively.

The following description sets forth a specific exemplary administrativetool environment in which the mechanism operates. Other exemplaryenvironments may include features of this specific embodiment and/orother features, which aim to facilitate constraint processing within aninteractive environment.

The following detailed description is divided into several sections. Afirst section describes an illustrative computing environment in whichthe administrative tool environment may operate. A second sectiondescribes an exemplary framework for the administrative toolenvironment. Subsequent sections describe individual components of theexemplary framework and the operation of these components. For example,the section on “Exemplary Processing of Scripts”, in conjunction withFIG. 12, describes an exemplary mechanism for obtaining and applyingconstraints in an interactive environment.

Exemplary Computing Environment

FIG. 1 illustrates an exemplary computing device that may be used in anexemplary administrative tool environment. In a very basicconfiguration, computing device 100 typically includes at least oneprocessing unit 102 and system memory 104. Depending on the exactconfiguration and type of computing device, system memory 104 may bevolatile (such as RAM), non-volatile (such as ROM, flash memory, etc.)or some combination of the two. System memory 104 typically includes anoperating system 105, one or more program modules 106, and may includeprogram data 107. The operating system 106 include a component-basedframework 120 that supports components (including properties andevents), objects, inheritance, polymorphism, reflection, and provides anobject-oriented component-based application programming interface (API),such as that of the .NET™ Framework manufactured by MicrosoftCorporation, Redmond, Wash. The operating system 105 also includes anadministrative tool framework 200 that interacts with thecomponent-based framework 120 to support development of administrativetools (not shown). This basic configuration is illustrated in FIG. 1 bythose components within dashed line 108.

Computing device 100 may have additional features or functionality. Forexample, computing device 109 may also include additional data storagedevices (removable and/or non-removable) such as, for example, magneticdisks, optical disks, or tape. Such additional storage is illustrated inFIG. 1 by removable storage 109 and non-removable storage 110. Computerstorage media may include volatile and nonvolatile, removable andnon-removable media implemented in any method or technology for storageof information, such as computer readable instructions, data structures,program modules, or other data. System memory 104, removable storage 109and non-removable storage 110 are all examples of computer storagemedia. Computer storage media includes, but is not limited to, RAM, ROM,EEPROM, flash memory or other memory technology, CD-ROM, digitalversatile disks (DVD) or other optical storage, magnetic cassettes,magnetic tape, magnetic disk storage or other magnetic storage devices,or any other medium which can be used to store the desired informationand which can be accessed by computing device 109. Any such computerstorage media may be part of device 100. Computing device 100 may alsohave input device(s) 112 such as keyboard, mouse, pen, voice inputdevice, touch input device, etc. Output device(s) 114 such as a display,speakers, printer, etc. may also be included. These devices are wellknow in the art and need not be discussed at length here.

Computing device 100 may also contain communication connections 116 thatallow the device to communicate with other computing devices 118, suchas over a network. Communication connections 116 are one example ofcommunication media. Communication media may typically be embodied bycomputer readable instructions, data structures, program modules, orother data in a modulated data signal, such as a carrier wave or othertransport mechanism, and includes any information delivery media. Theterm “modulated data signal” means a signal that has one or more of itscharacteristics set or changed in such a manner as to encode informationin the signal. By way of example, and not limitation, communicationmedia includes wired media such as a wired network or direct-wiredconnection, and wireless media such as acoustic, RF, infrared and otherwireless media. The term computer readable media as used herein includesboth storage media and communication media.

Exemplary Administrative Tool Framework

FIG. 2 is a block diagram generally illustrating an overview of anexemplary administrative tool framework 200. Administrative toolframework 200 includes one or more host components 202, host-specificcomponents 204, host-independent components 206, and handler components208. The host-independent components 206 may communicate with each ofthe other components (i.e., the host components 202, the host-specificcomponents 204, and the handler components 208). Each of thesecomponents are briefly described below and described in further detail,as needed, in subsequent sections.

Host Components

The host components 202 include one or more host programs (e.g., hostprograms 210-214) that expose automation features for an associatedapplication to users or to other programs. Each host program 210-214 mayexpose these automation features in its own particular style, such asvia a command line, a graphical user interface (GUI), a voicerecognition interface, application programming interface (API), ascripting language, a web service, and the like. However, each of thehost programs 210-214 expose the one or more automation features througha mechanism provided by the administrative tool framework.

In this example, the mechanism uses cmdlets to surface theadministrative tool capabilities to a user of the associated hostprogram 210-214. In addition, the mechanism uses a set of interfacesmade available by the host to embed the administrative tool environmentwithin the application associated with the corresponding host program210-214. Throughout the following discussion, the term “cmdlet” is usedto refer to commands that are used within the exemplary administrativetool environment described with reference to FIGS. 2-23.

Cmdlets correspond to commands in traditional administrativeenvironments. However, cmdlets are quite different than thesetraditional commands. For example, cmdlets are typically smaller in sizethan their counterpart commands because the cmdlets can utilize commonfunctions provided by the administrative tool framework, such asparsing, data validation, error reporting, and the like. Because suchcommon functions can be implemented once and tested once, the use ofcmdlets throughout the administrative tool framework allows theincremental development and test costs associated withapplication-specific functions to be quite low compared to traditionalenvironments.

In addition, in contrast to traditional environments, cmdlets do notneed to be stand-alone executable programs. Rather, cmdlets may run inthe same processes within the administrative tool framework. This allowscmdlets to exchange “live” objects between each other. This ability toexchange “live” objects allows the cmdlets to directly invoke methods onthese objects. The details for creating and using cmdlets are describedin further detail below.

In overview, each host program 210-214 manages the interactions betweenthe user and the other components within the administrative toolframework. These interactions may include prompts for parameters,reports of errors, and the like. Typically, each host program 210-213may provide its own set of specific host cmdlets (e.g., host cmdlets218). For example, if the host program is an email program, the hostprogram may provide host cmdlets that interact with mailboxes andmessages. Even though FIG. 2 illustrates host programs 210-214, oneskilled in the art will appreciate that host components 202 may includeother host programs associated with existing or newly createdapplications. These other host programs will also embed thefunctionality provided by the administrative tool environment withintheir associated application. The processing provided by a host programis described in detail below in conjunction with FIG. 8.

In the examples illustrated in FIG. 2, a host program may be amanagement console (i.e., host program 210) that provides a simple,consistent, administration user interface for users to create, save, andopen administrative tools that manage the hardware, software, andnetwork components of the computing device. To accomplish thesefunctions, host program 210 provides a set of services for buildingmanagement GUIs on top of the administrative tool framework. The GUIinteractions may also be exposed as user-visible scripts that help teachthe users the scripting capabilities provided by the administrative toolenvironment.

In another example, the host program may be a command line interactiveshell (i.e., host program 212). The command line interactive shell mayallow shell metadata 216 to be input on the command line to affectprocessing of the command line.

In still another example, the host program may be a web service (i.e.,host program 214) that uses industry standard specifications fordistributed computing and interoperability across platforms, programminglanguages, and applications.

In addition to these examples, third parties may add their own hostcomponents by creating “third party” or “provider” interfaces andprovider cmdlets that are used with their host program or other hostprograms. The provider interface exposes an application orinfrastructure so that the application or infrastructure can bemanipulated by the administrative tool framework. The provider cmdletsprovide automation for navigation, diagnostics, configuration,lifecycle, operations, and the like. The provider cmdlets exhibitpolymorphic cmdlet behavior on a completely heterogeneous set of datastores. The administrative tool environment operates on the providercmdlets with the same priority as other cmdlet classes. The providercmdlet is created using the same mechanisms as the other cmdlets. Theprovider cmdlets expose specific functionality of an application or aninfrastructure to the administrative tool framework. Thus, through theuse of cmdlets, product developers need only create one host componentthat will then allow their product to operate with many administrativetools. For example, with the exemplary administrative tool environment,system level graphical user interface help menus may be integrated andported to existing applications.

Host-Specific Components

The host-specific components 204 include a collection of services thatcomputing systems (e.g., computing device 100 in FIG. 1) use to isolatethe administrative tool framework from the specifics of the platform onwhich the framework is running. Thus, there is a set of host-specificcomponents for each type of platform. The host-specific components allowthe users to use the same administrative tools on different operatingsystems.

Turning briefly to FIG. 3, the host-specific components 204 may includean intellisense/metadata access component 302, a help cmdlet component304, a configuration/registration component 306, a cmdlet setupcomponent 308, and an output interface component 309 Components 302-308communicate with a database store manager 312 associated with a databasestore 314. The parser 220 and script engine 222 communicate with theintellisense/metadata access component 302. The core engine 224communicates with the help cmdlet component 304, theconfiguration/registration component 306, the cmdlet setup component308, and the output interface component 309. The output interfacecomponent 309 includes interfaces provided by the host to out cmdlets.These out cmdlets can then call the host's output object to perform therendering. Host-specific components 204 may also include alogging/auditing component 310, which the core engine 224 uses tocommunicate with host specific (i.e., platform specific) services thatprovide logging and auditing capabilities.

In one exemplary administrative tool framework, theintellisense/metadata access component 302 provides auto-completion ofcommands, parameters, and parameter values. The help cmdlet component304 provides a customized help system based on a host user interface.

Handler Components

Referring back to FIG. 2, the handler components 208 includes legacyutilities 230, management cmdlets 232, non-management cmdlets 234,remoting cmdlets 236, and a web service interface 238. The managementcmdlets 232 (also referred to as platform cmdlets) include cmdlets thatquery or manipulate the configuration information associated with thecomputing device. Because management cmdlets 232 manipulate system typeinformation, they are dependant upon a particular platform. However,each platform typically has management cmdlets 232 that provide similaractions as management cmdlets 232 on other platforms. For example, eachplatform supports management cmdlets 232 that get and set systemadministrative attributes (e.g., get/process, set/IPAddress). Thehost-independent components 206 communicate with the management cmdletsvia cmdlet objects generated within the host-independent components 206.Exemplary data structures for cmdlets objects will be described indetail below in conjunction with FIGS. 5-7.

The non-management cmdlets 234 (sometimes referred to as base cmdlets)include cmdlets that group, sort, filter, and perform other processingon objects provided by the management cmdlets 232. The non-managementcmdlets 234 may also include cmdlets for formatting and outputting dataassociated with the pipelined objects. An exemplary mechanism forproviding a data driven command line output is described below inconjunction with FIGS. 19-23. The non-management cmdlets 234 may be thesame on each platform and provide a set of utilities that interact withhost-independent components 206 via cmdlet objects. The interactionsbetween the non-management cmdlets 234 and the host-independentcomponents 206 allow reflection on objects and allow processing on thereflected objects independent of their (object) type. Thus, theseutilities allow developers to write non-management cmdlets once and thenapply these non-management cmdlets across all classes of objectssupported on a computing system. In the past, developers had to firstcomprehend the format of the data that was to be processed and thenwrite the application to process only that data. As a consequence,traditional applications could only process data of a very limitedscope. One exemplary mechanism for processing objects independent oftheir object type is described below in conjunction with FIG. 18.

The legacy utilities 230 include existing executables, such as win32executables that run under cmd.exe. Each legacy utility 230 communicateswith the administrative tool framework using text streams (i.e., stdinand stdout), which are a type of object within the object framework.Because the legacy utilities 230 utilize text streams, reflection-basedoperations provided by the administrative tool framework are notavailable. The legacy utilities 230 execute in a different process thanthe administrative tool framework. Although not shown, other cmdlets mayalso operate out of process.

The remoting cmdlets 236, in combination with the web service interface238, provide remoting mechanisms to access interactive and programmaticadministrative tool environments on other computing devices over acommunication media, such as internet or intranet (e.g.,internet/intranet 240 shown in FIG. 2). In one exemplary administrativetool framework, the remoting mechanisms support federated services thatdepend on infrastructure that spans multiple independent controldomains. The remoting mechanism allows scripts to execute on remotecomputing devices. The scripts may be run on a single or on multipleremote systems. The results of the scripts may be processed as eachindividual script completes or the results may be aggregated andprocessed en-masse after all the scripts on the various computingdevices have completed.

For example, web service 214 shown as one of the host components 202 maybe a remote agent. The remote agent handles the submission of remotecommand requests to the parser and administrative tool framework on thetarget system. The remoting cmdlets serve as the remote client toprovide access to the remote agent. The remote agent and the remotingcmdlets communicate via a parsed stream. This parsed stream may beprotected at the protocol layer, or additional cmdlets may be used toencrypt and then decrypt the parsed stream.

Host-Independent Components

The host-independent components 206 include a parser 220, a scriptengine 222 and a core engine 224. The host-independent components 206provide mechanisms and services to group multiple cmdlets, coordinatethe operation of the cmdlets, and coordinate the interaction of otherresources, sessions, and jobs with the cmdlets.

Exemplary Parser

The parser 220 provides mechanisms for receiving input requests fromvarious host programs and mapping the input requests to uniform cmdletobjects that are used throughout the administrative tool framework, suchas within the core engine 224. In addition, the parser 220 may performdata processing based on the input received. One exemplary method forperforming data processing based on the input is described below inconjunction with FIG. 12. The parser 220 of the present administrativetool framework provides the capability to easily expose differentlanguages or syntax to users for the same capabilities. For example,because the parser 220 is responsible for interpreting the inputrequests, a change to the code within the parser 220 that affects theexpected input syntax will essentially affect each user of theadministrative tool framework. Therefore, system administrators mayprovide different parsers on different computing devices that supportdifferent syntax. However, each user operating with the same parser willexperience a consistent syntax for each cmdlet. In contrast, intraditional environments, each command implemented its own syntax. Thus,with thousands of commands, each environment supported several differentsyntax, usually many of which were inconsistent with each other.

Exemplary Script Engine

The script engine 222 provides mechanisms and services to tie multiplecmdlets together using a script. A script is an aggregation of commandlines that share session state under strict rules of inheritance. Themultiple command lines within the script may be executed eithersynchronously or asynchronously, based on the syntax provided in theinput request. The script engine 222 has the ability to process controlstructures, such as loops and conditional clauses and to processvariables within the script. The script engine also manages sessionstate and gives cmdlets access to session data based on a policy (notshown).

Exemplary Core Engine

The core engine 224 is responsible for processing cmdlets identified bythe parser 220. Turning briefly to FIG. 4, an exemplary core engine 224within the administrative tool framework 200 is illustrated. Theexemplary core engine 224 includes a pipeline processor 402, a loader404, a metadata processor 406, an error & event handler 408, a sessionmanager 410, and an extended type manager 412.

Exemplary Metadata Processor

The metadata processor 406 is configured to access and store metadatawithin a metadata store, such as database store 314 shown in FIG. 3. Themetadata may be supplied via the command line, within a cmdlet classdefinition, and the like. Different components within the administrativetool framework 200 may request the metadata when performing theirprocessing. For example, parser 202 may request metadata to validateparameters supplied on the command line.

Exemplary Error & Event Processor

The error & event processor 408 provides an error object to storeinformation about each occurrence of an error during processing of acommand line. For additional information about one particular error andevent processor which is particularly suited for the presentadministrative tool framework, refer to U.S. patent application Ser. No.______/U.S. Pat. No. ______, entitled “System and Method for PersistingError Information in a Command Line Environment”, which is owned by thesame assignee as the present invention, and is incorporated here byreference.

Exemplary Session Manager

The session manager 410 supplies session and state information to othercomponents within the administrative tool framework 200. The stateinformation managed by the session manager may be accessed by anycmdlet, host, or core engine via programming interfaces. Theseprogramming interfaces allow for the creation, modification, anddeletion of state information.

Exemplary Pipeline Processor and Loader

The loader 404 is configured to load each cmdlet in memory in order forthe pipeline processor 402 to execute the cmdlet. The pipeline processor402 includes a cmdlet processor 420 and a cmdlet manager 422. The cmdletprocessor 420 dispatches individual cmdlets. If the cmdlet requiresexecution on a remote, or a set of remote machines, the cmdlet processor420 coordinates the execution with the remoting cmdlet 236 shown in FIG.2. The cmdlet manager 422 handles the execution of aggregations ofcmdlets. The cmdlet manager 422, the cmdlet processor 420, and thescript engine 222 (FIG. 2) communicate with each other in order toperform the processing on the input received from the host program210-214. The communication may be recursive in nature. For example, ifthe host program provides a script, the script may invoke the cmdletmanager 422 to execute a cmdlet, which itself may be a script. Thescript may then be executed by the script engine 222. One exemplaryprocess flow for the core engine is described in detail below inconjunction with FIG. 14.

Exemplary Extended Type Manager

As mentioned above, the administrative tool framework provides a set ofutilities that allows reflection on objects and allows processing on thereflected objects independent of their (object) type. The administrativetool framework 200 interacts with the component framework on thecomputing system (component framework 120 in FIG. 1) to perform thisreflection. As one skilled in the art will appreciate, reflectionprovides the ability to query an object and to obtain a type for theobject, and then reflect on various objects and properties associatedwith that type of object to obtain other objects and/or a desired value.

Even though reflection provides the administrative tool framework 200 aconsiderable amount of information on objects, the inventors appreciatedthat reflection focuses on the type of object. For example, when adatabase datatable is reflected upon, the information that is returnedis that the datatable has two properties: a column property and a rowproperty. These two properties do not provide sufficient detailregarding the “objects” within the datatable. Similar problems arisewhen reflection is used on extensible markup language (XML) and otherobjects.

Thus, the inventors conceived of an extended type manager 412 thatfocuses on the usage of the type. For this extended type manager, thetype of object is not important. Instead, the extended type manager isinterested in whether the object can be used to obtain requiredinformation. Continuing with the above datatable example, the inventorsappreciated that knowing that the datatable has a column property and arow property is not particularly interesting, but appreciated that onecolumn contained information of interest. Focusing on the usage, onecould associate each row with an “object” and associate each column witha “property” of that “object”. Thus, the extended type manager 412provides a mechanism to create “objects” from any type of preciselyparse-able input. In so doing, the extended type manager 412 supplementsthe reflection capabilities provided by the component-based framework120 and extends “reflection” to any type of precisely parse-able input.

In overview, the extended type manager is configured to access preciselyparse-able input (not shown) and to correlate the precisely parse-ableinput with a requested data type. The extended type manager 412 thenprovides the requested information to the requesting component, such asthe pipeline processor 402 or parser 220. In the following discussion,precisely parse-able input is defined as input in which properties andvalues may be discerned. Some exemplary precisely parse-able inputinclude Windows Management Instrumentation (WMI) input, ActiveX DataObjects (ADO) input, eXtensible Markup Language (XML) input, and objectinput, such as .NET objects. Other precisely parse-able input mayinclude third party data formats.

Turning briefly to FIG. 18, a functional block diagram of an exemplaryextended type manager for use within the administrative tool frameworkis shown. For explanation purposes, the functionality (denoted by thenumber “3” within a circle) provided by the extended type manager iscontrasted with the functionality provided by a traditional tightlybound system (denoted by the number “1” within a circle) and thefunctionality provided by a reflection system (denoted by the number “2”within a circle). In the traditional tightly bound system, a caller 1802within an application directly accesses the information (e.g.,properties P1 and P2, methods M1 and M2) within object A. As mentionedabove, the caller 1802 must know, a priori, the properties (e.g.,properties P1 and P2) and methods (e.g., methods M1 and M2) provided byobject A at compile time. In the reflection system, generic code 1820(not dependent on any data type) queries a system 1808 that performsreflection 1810 on the requested object and returns the information(e.g., properties P1 and P2, methods M1 and M2) about the object (e.g.,object A) to the generic code 1820. Although not shown in object A, thereturned information may include additional information, such as vendor,file, date, and the like. Thus, through reflection, the generic code1820 obtains at least the same information that the tightly bound systemprovides. The reflection system also allows the caller 1802 to query thesystem and get additional information without any a priori knowledge ofthe parameters.

In both the tightly bound systems and the reflection systems, new datatypes can not be easily incorporated within the operating environment.For example, in a tightly bound system, once the operating environmentis delivered, the operating environment can not incorporate new datatypes because it would have to be rebuilt in order to support them.Likewise, in reflection systems, the metadata for each object class isfixed. Thus, incorporating new data types is not usually done.

However, with the present extended type manager new data types can beincorporated into the operating system. With the extended type manager1822, generic code 1820 may reflect on a requested object to obtainextended data types (e.g., object A′) provided by various externalsources, such as a third party objects (e.g., object A′ and B), asemantic web 1832, an ontology service 1834, and the like. As shown, thethird party object may extend an existing object (e.g., object A′) ormay create an entirely new object (e.g., object B).

Each of these external sources may register their unique structurewithin a type metadata 1840 and may provide code 1842. When an object isqueried, the extended type manager reviews the type metadata 1840 todetermine whether the object has been registered. If the object is notregistered within the type metadata 1840, reflection is performed.Otherwise, extended reflection is performed. The code 1842 returns theadditional properties and methods associated with the type beingreflected upon. For example, if the input type is XML, the code 1842 mayinclude a description file that describes the manner in which the XML isused to create the objects from the XML document. Thus, the typemetadata 1840 describes how the extended type manager 412 should queryvarious types of precisely parse-able input (e.g., third party objectsA′ and B, semantic web 1832) to obtain the desired properties forcreating an object for that specific input type and the code 1842provides the instructions to obtain these desired properties. As aresult, the extended type manager 412 provides a layer of indirectionthat allows “reflection” on all types of objects.

In addition to providing extended types, the extend type manager 412provides additional query mechanisms, such as a property path mechanism,a key mechanism, a compare mechanism, a conversion mechanism, a globbermechanism, a property set mechanism, a relationship mechanism, and thelike. Each of these query mechanisms, described below in the section“Exemplary Extended Type Manager Processing”, provides flexibility tosystem administrators when entering command strings. Various techniquesmay be used to implement the semantics for the extended type manager.Three techniques are described below. However, those skilled in the artwill appreciate that variations of these techniques may be used withoutdeparting from the scope of the claimed invention.

In one technique, a series of classes having static methods (e.g.,getproperty( )) may be provided. An object is input into the staticmethod (e.g., getproperty(object)), and the static method returns a setof results. In another technique, the operating environment envelopesthe object with an adapter. Thus, no input is supplied. Each instance ofthe adapter has a getproperty method that acts upon the enveloped objectand returns the properties for the enveloped object. The following ispseudo code illustrating this technique: Class Adaptor {   Object X;  getProperties( ); }.

In still another technique, an adaptor class subclasses the object.Traditionally, subclassing occurred before compilation. However, withcertain operating environments, subclassing may occur dynamically. Forthese types of environments, the following is pseudo code illustratingthis technique: Class Adaptor : A {   getProperties( )   {     returndata;   } }.

Thus, as illustrated in FIG. 18, the extended type manager allowsdevelopers to create a new data type, register the data type, and allowother applications and cmdlets to use the new data type. In contrast, inprior administrative environments, each data type had to be known atcompile time so that a property or method associated with an objectinstantiated from that data type could be directly accessed. Therefore,adding new data types that were supported by the administrativeenvironment was seldom done in the past.

Referring back to FIG. 2, in overview, the administrative tool framework200 does not rely on the shell for coordinating the execution ofcommands input by users, but rather, splits the functionality intoprocessing portions (e.g., host-independent components 206) and userinteraction portions (e.g., via host cmdlets). In addition, the presentadministrative tool environment greatly simplifies the programming ofadministrative tools because the code required for parsing and datavalidation is no longer included within each command, but is ratherprovided by components (e.g., parser 220) within the administrative toolframework. The exemplary processing performed within the administrativetool framework is described below.

Exemplary Operation

FIGS. 5-7 graphically illustrate exemplary data structures used withinthe administrative tool environment. FIGS. 8-17 graphically illustrateexemplary processing flows within the administrative tool environment.One skilled in the art will appreciate that certain processing may beperformed by a different component than the component described belowwithout departing from the scope of the present invention. Beforedescribing the processing performed within the components of theadministrative tool framework, exemplary data structures used within theadministrative tool framework are described.

Exemplary Data Structures for Cmdlet Objects

FIG. 5 is an exemplary data structure for specifying a cmdlet suitablefor use within the administrative tool framework shown in FIG. 2. Whencompleted, the cmdlet may be a management cmdlet, a non-managementcmdlet, a host cmdlet, a provider cmdlet, or the like. The followingdiscussion describes the creation of a cmdlet with respect to a systemadministrator's perspective (i.e., a provider cmdlet). However, eachtype of cmdlet is created in the same manner and operates in a similarmanner. A cmdlet may be written in any language, such as C#. Inaddition, the cmdlet may be written using a scripting language or thelike. When the administrative tool environment operates with the .NETFramework, the cmdlet may be a .NET object.

The provider cmdlet 500 (hereinafter, referred to as cmdlet 500) is apublic class having a cmdlet class name (e.g., StopProcess 504). Cmdlet500 derives from a cmdlet class 506. An exemplary data structure for acmdlet class 506 is described below in conjunction with FIG. 6. Eachcmdlet 500 is associated with a command attribute 502 that associates aname (e.g., Stop/Process) with the cmdlet 500. The name is registeredwithin the administrative tool environment. As will be described below,the parser looks in the cmdlet registry to identify the cmdlet 500 whena command string having the name (e.g., Stop/Process) is supplied asinput on a command line or in a script.

The cmdlet 500 is associated with a grammar mechanism that defines agrammar for expected input parameters to the cmdlet. The grammarmechanism may be directly or indirectly associated with the cmdlet. Forexample, the cmdlet 500 illustrates a direct grammar association. Inthis cmdlet 500, one or more public parameters (e.g., ProcessName 510and PID 512) are declared. The declaration of the public parametersdrives the parsing of the input objects to the cmdlet 500.Alternatively, the description of the parameters may appear in anexternal source, such as an XML document. The description of theparameters in this external source would then drive the parsing of theinput objects to the cmdlet.

Each public parameter 510, 512 may have one or more attributes (i.e.,directives) associated with it. The directives may be from any of thefollowing categories: parsing directive 521, data validation directive522, data generation directive 523, processing directive 524, encodingdirective 525, and documentation directive 526. The directives may besurrounded by square brackets. Each directive describes an operation tobe performed on the following expected input parameter. Some of thedirectives may also be applied at a class level, such asuser-interaction type directives. The directives are stored in themetadata associated with the cmdlet. The application of these attributesis described below in conjunction with FIG. 12.

These attributes may also affect the population of the parametersdeclared within the cmdlet. One exemplary process for populating theseparameters is described below in conjunction with FIG. 16. The coreengine may apply these directives to ensure compliance. The cmdlet 500includes a first method 530 (hereinafter, interchangeably referred to asStartProcessing method 530) and a second method 540 (hereinafter,interchangeably referred to as processRecord method 540). The coreengine uses the first and second methods 530, 540 to direct theprocessing of the cmdlet 500. For example, the first method 530 isexecuted once and performs set-up functions. The code 542 within thesecond method 540 is executed for each object (e.g., record) that needsto be processed by the cmdlet 500. The cmdlet 500 may also include athird method (not shown) that cleans up after the cmdlet 500.

Thus, as shown in FIG. 5, code 542 within the second method 540 istypically quite brief and does not contain functionality required intraditional administrative tool environments, such as parsing code, datavalidation code, and the like. Thus, system administrators can developcomplex administrative tasks without learning a complex programminglanguage.

FIG. 6 is an exemplary data structure 600 for specifying a cmdlet baseclass 602 from which the cmdlet shown in FIG. 5 is derived. The cmdletbase class 602 includes instructions that provide additionalfunctionality whenever the cmdlet includes a hook statement and acorresponding switch is input on the command line or in the script(jointly referred to as command input).

The exemplary data structure 600 includes parameters, such as Booleanparameter verbose 610, whatif 620, and confirm 630. As will be explainedbelow, these parameters correspond to strings that may be entered on thecommand input. The exemplary data structure 600 may also include asecurity method 640 that determines whether the task being requested forexecution is allowed.

FIG. 7 is another exemplary data structure 700 for specifying a cmdlet.In overview, the data structure 700 provides a means for clearlyexpressing a contract between the administrative tool framework and thecmdlet. Similar to data structure 500, data structure 700 is a publicclass that derives from a cmdlet class 704. The software developerspecifies a cmdletDeclaration 702 that associates a noun/verb pair, suchas “get/process” and “format/table”, with the cmdlet 700. The noun/verbpair is registered within the administrative tool environment. The verbor the noun may be implicit in the cmdlet name. Also, similar to datastructure 500, data structure 700 may include one or more public members(e.g., Name 730, Recurse 732), which may be associated with the one ormore directives 520-526 described in conjunction with data structure500.

However, in this exemplary data structure 700, each of the expectedinput parameters 730 and 732 is associated with an input attribute 731and 733, respectively. The input attributes 731 and 733 specifying thatthe data for its respective parameter 730 and 732 should be obtainedfrom the command line. Thus, in this exemplary data structure 700, thereare not any expected input parameters that are populated from apipelined object that has been emitted by another cmdlet. Thus, datastructure 700 does not override the first method (e.g., StartProcessing)or the second method (e.g., ProcessRecord) which are provided by thecmdlet base class.

The data structure 700 may also include a private member 740 that is notrecognized as an input parameter. The private member 740 may be used forstoring data that is generated based on one of the directives.

Thus, as illustrated in data structure 700, through the use of declaringpublic properties and directives within a specific cmdlet class, cmdletdevelopers can easily specify a grammar for the expected inputparameters to their cmdlets and specify processing that should beperformed on the expected input parameters without requiring the cmdletdevelopers to generate any of the underlying logic. Data structure 700illustrates a direct association between the cmdlet and the grammarmechanism. As mentioned above, this associated may also be indirect,such as by specifying the expected parameter definitions within anexternal source, such as an XML document.

The exemplary process flows within the administrative tool environmentare now described.

Exemplary Host Processing Flow

FIG. 8 is a logical flow diagram illustrating an exemplary process forhost processing that is performed within the administrative toolframework shown in FIG. 2. The process 800 begins at block 801, where arequest has been received to initiate the administrative toolenvironment for a specific application. The request may have been sentlocally through keyboard input, such as selecting an application icon,or remotely through the web services interface of a different computingdevice. For either scenario, processing continues to block 802.

At block 802, the specific application (e.g., host program) on the“target” computing device sets up its environment. This includesdetermining which subsets of cmdlets (e.g., management cmdlets 232,non-management cmdlets 234, and host cmdlets 218) are made available tothe user. Typically, the host program will make all the non-managementcmdlets 234 available and its own host cmdlets 218 available. Inaddition, the host program will make a subset of the management cmdlets234 available, such as cmdlets dealing with processes, disk, and thelike. Thus, once the host program makes the subsets of cmdletsavailable, the administrative tool framework is effectively embeddedwithin the corresponding application. Processing continues to block 804.

At block 804, input is obtained through the specific application. Asmentioned above, input may take several forms, such as command lines,scripts, voice, GUI, and the like. For example, when input is obtainedvia a command line, the input is retrieve from the keystrokes entered ona keyboard. For a GUI host, a string is composed based on the GUI.Processing continues at block 806.

At block 806, the input is provided to other components within theadministrative tool framework for processing. The host program mayforward the input directly to the other components, such as the parser.Alternatively, the host program may forward the input via one of itshost cmdlets. The host cmdlet may convert its specific type of input(e.g., voice) into a type of input (e.g., text string, script) that isrecognized by the administrative tool framework. For example, voiceinput may be converted to a script or command line string depending onthe content of the voice input. Because each host program is responsiblefor converting their type of input to an input recognized by theadministrative tool framework, the administrative tool framework canaccept input from any number of various host components. In addition,the administrative tool framework is provides a rich set of utilitiesthat perform conversions between data types when the input is forwardedvia one of its cmdlets. Processing performed on the input by the othercomponents is described below in conjunction with several other figures.Host processing continues at decision block 808.

At decision block 808, a determination is made whether a request wasreceived for additional input. This may occur if one of the othercomponents responsible for processing the input needs additionalinformation from the user in order to complete its processing. Forexample, a password may be required to access certain data, confirmationof specific actions may be needed, and the like. For certain types ofhost programs (e.g., voice mail), a request such as this may not beappropriate. Thus, instead of querying the user for additionalinformation, the host program may serialize the state, suspend thestate, and send a notification so that at a later time the state may beresumed and the execution of the input be continued. In anothervariation, the host program may provide a default value after apredetermined time period. If a request for additional input isreceived, processing loops back to block 804, where the additional inputis obtained. Processing then continues through blocks 806 and 808 asdescribed above. If no request for additional input is received and theinput has been processed, processing continues to block 810.

At block 810, results are received from other components within theadministrative tool framework. The results may include error messages,status, and the like. The results are in an object form, which isrecognized and processed by the host cmdlet within the administrativetool framework. As will be described below, the code written for eachhost cmdlet is very minimal. Thus, a rich set of output may be displayedwithout requiring a huge investment in development costs. Processingcontinues at block 812.

At block 812, the results may be viewed. The host cmdlet converts theresults to the display style supported by the host program. For example,a returned object may be displayed by a GUI host program using agraphical depiction, such as an icon, barking dog, and the like. Thehost cmdlet provides a default format and output for the data. Thedefault format and output may utilize the exemplary output processingcmdlets described below in conjunction with FIGS. 19-23. After theresults are optionally displayed, the host processing is complete.

Exemplary Process Flows for Handling Input

FIG. 9 is a logical flow diagram illustrating an exemplary process forhandling input that is performed within the administrative toolframework shown in FIG. 2. Processing begins at block 901 where inputhas been entered via a host program and forwarded to other componentswithin the administrative tool framework. Processing continues at block902.

At block 902, the input is received from the host program. In oneexemplary administrative tool framework, the input is received by theparser, which deciphers the input and directs the input for furtherprocessing. Processing continues at decision block 904.

At decision block 904, a determination is made whether the input is ascript. The input may take the form of a script or a string representinga command line (hereinafter, referred to as a “command string”). Thecommand string may represent one or more cmdlets pipelined together.Even though the administrative tool framework supports several differenthosts, each host provides the input as either a script or a commandstring for processing. As will be shown below, the interaction betweenscripts and command strings is recursive in nature. For example, ascript may have a line that invokes a cmdlet. The cmdlet itself may be ascript.

Thus, at decision block 904, if the input is in a form of a script,processing continues at block 906, where processing of the script isperformed. Otherwise, processing continues at block 908, whereprocessing of the command string is performed. Once the processingperformed within either block 906 or 908 is completed, processing of theinput is complete.

Exemplary Processing of Scripts

FIG. 10 is a logical flow diagram illustrating a process for processinga script suitable for use within the process for handling input shown inFIG. 9. The process begins at block 1001, where the input has beenidentified as a script. The script engine and parser communicate witheach other to perform the following functions. Processing continues atblock 1002.

At block 1002, pre-processing is performed on the script. Briefly,turning to FIG. 11, a logical flow diagram is shown that illustrates ascript pre-processing process 1100 suitable for use within the scriptprocessing process 1000. Script pre-processing begins at block 1101 andcontinues to decision block 1102.

At decision block 1102, a determination is made whether the script isbeing run for the first time. This determination may be based oninformation obtained from a registry or other storage mechanism. Thescript is identified from within the storage mechanism and theassociated data is reviewed. If the script has not run previously,processing continues at block 1104.

At block 1104, the script is registered in the registry. This allowsinformation about the script to be stored for later access by componentswithin the administrative tool framework. Processing continues at block1106.

At block 1106, help and documentation are extracted from the script andstored in the registry. Again, this information may be later accessed bycomponents within the administrative tool framework. The script is nowready for processing and returns to block 1004 in FIG. 10.

Returning to decision block 1102, if the process concludes that thescript has run previously, processing continues to decision block 1108.At decision block 1108, a determination is made whether the scriptfailed during processing. This information may be obtained from theregistry. If the script has not failed, the script is ready forprocessing and returns to block 1004 in FIG. 10.

However, if the script has failed, processing continues at block 1110.At block 1110, the script engine may notify the user through the hostprogram that the script has previously failed. This notification willallow a user to decide whether to proceed with the script or to exit thescript. As mentioned above in conjunction with FIG. 8, the host programmay handle this request in various ways depending on the style of input(e.g., voice, command line). Once additional input is received from theuser, the script either returns to block 1004 in FIG. 10 for processingor the script is aborted.

Returning to block 1004 in FIG. 10, a line from the script is retrieved.Processing continues at decision block 1006. At decision block 1006, adetermination is made whether the line includes any constraints. Aconstraint is detected by a predefined begin character (e.g., a bracket“[”) and a corresponding end character (e.g., a close bracket “]”). Ifthe line includes constraints, processing continues to block 1008.

At block 1008, the constraints included in the line are applied. Ingeneral, the constraints provide a mechanism within the administrativetool framework to specify a type for a parameter entered in the scriptand to specify validation logic which should be performed on theparameter. The constraints are not only applicable to parameters, butare also applicable to any type of construct entered in the script, suchas variables. Thus, the constraints provide a mechanism within aninterpretive environment to specify a data type and to validateparameters. In traditional environments, system administrators areunable to formally test parameters entered within a script. An exemplaryprocess for applying constraints is illustrated in FIG. 12.

At decision block 1010, a determination is made whether the line fromthe script includes built-in capabilities. Built-in capabilities arecapabilities that are not performed by the core engine. Built-incapabilities may be processed using cmdlets or may be processed usingother mechanisms, such as in-line functions. If the line does not havebuilt-in capabilities, processing continues at decision block 1014.Otherwise, processing continues at block 1012.

At block 1012, the built-in capabilities provided on the line of thescript are processed. Example built-in capabilities may includeexecution of control structures, such as “if” statements, “for” loops,switches, and the like. Built-in capabilities may also includeassignment type statements (e.g., a=3). Once the built-in capabilitieshave been processed, processing continues to decision block 1014.

At decision block 1014, a determination is made whether the line of thescript includes a command string. The determination is based on whetherthe data on the line is associated with a command string that has beenregistered and with a syntax of the potential cmdlet invocation. Asmentioned above, the processing of command strings and scripts may berecursive in nature because scripts may include command strings andcommand strings may execute a cmdlet that is a script itself. If theline does not include a command string, processing continues at decisionblock 1018. Otherwise, processing continues at block 1016.

At block 1016, the command string is processed. In overview, theprocessing of the command string includes identifying a cmdlet class bythe parser and passing the corresponding cmdlet object to the coreengine for execution. The command string may also include a pipelinedcommand string that is parsed into several individual cmdlet objects andindividually processed by the core engine. One exemplary process forprocessing command strings is described below in conjunction with FIG.14. Once the command string is processed, processing continues atdecision block 1018.

At decision block 1018, a determination is made whether there is anotherline in the script. If there is another line in the script, processingloops back to block 1004 and proceeds as described above in blocks1004-1016. Otherwise, processing is complete.

An exemplary process for applying constraints in block 1008 isillustrated in FIG. 12. The process begins at block 1201 where aconstraint is detected in the script or in the command string on thecommand line. When the constraint is within a script, the constraintsand the associated construct may occur on the same line or on separatelines. When the constraint is within a command string, the constraintand the associated construct occur before the end of line indicator(e.g., enter key). Processing continues to block 1202.

At block 1202, constraints are obtained from the interpretiveenvironment. In one exemplary administrative tool environment, theparser deciphers the input and determines the occurrence of constraints.Constraints may be from one of the following categories: predicatedirective, parsing directive, data validation directive, data generationdirective, processing directive, encoding directive, and documentationdirective. In one exemplary parsing syntax, the directives aresurrounded by square brackets and describe the construct that followsthem. The construct may be a function, a variable, a script, or thelike.

As will be described below, through the use of directives, scriptauthors are allowed to easily type and perform processing on theparameters within the script or command line (i.e., an interpretiveenvironment) without requiring the script authors to generate any of theunderlying logic. Processing continues to block 1204.

At block 1204, the constraints that are obtained are stored in themetadata for the associated construct. The associated construct isidentified as being the first non-attribution token after one or moreattribution tokens (tokens that denote constraints) have beenencountered. Processing continues to block 1206.

At block 1206, whenever the construct is encountered within the scriptor in the command string, the constraints defined within the metadataare applied to the construct. The constraints may include data type,predicate directives 1210, documentation directives 1212, parsingdirectives 1214, data generation directives 1216, data validationdirectives 1218, and object processing and encoding directives 1220.Constraints specifying data types may specify any data type supported bythe system on which the administrative tool framework is running.Predicate directives 1210 are directives that indicate whetherprocessing should occur. Thus, predicate directives 1210 ensure that theenvironment is correct for execution. For example, a script may includethe following predicate directive:[PredicateScript(“isInstalled”,“ApplicationZ”)].

The predicate directive ensures that the correct application isinstalled on the computing device before running the script. Typically,system environment variables may be specified as predicate directives.Exemplary directives from directive types 1212-1220 are illustrated inTables 1-5. Processing of the script is then complete.

Thus, the present process for applying types and constraints within aninterpretive environment, allows system administrators to easily specifya type, specify validation requirements, and the like without having towrite the underlying logic for performing this processing. The followingis an example of the constraint processing performed on a command stringspecified as follows:[Integer][ValidationRange(3,5)]$a=4.

There are two constraints specified via attribution tokens denoted by “[]”. The first attribution token indicates that the variable is a typeinteger and a second attribution token indicates that the value of thevariable $a must be between 3 and inclusive. The example command stringensures that if the variable $a is assigned in a subsequent commandstring or line, the variable $a will be checked against the twoconstraints. Thus, the following command strings would each result in anerror:$a=231$a=“apple”$a=$(get/location).

The constraints are applied at various stages within the administrativetool framework. For example, applicability directives, documentationdirectives, and parsing guideline directives are processed at a veryearly stage within the parser. Data generation directives and validationdirectives are processed in the engine once the parser has finishedparsing all the input parameters.

The following tables illustrate representative directives for thevarious categories, along with an explanation of the processingperformed by the administrative tool environment in response to thedirective. TABLE 1 Applicability Directives Name DescriptionPrerequisiteMachineRoleAttribute Informs shell whether element is to beused only in certain machine roles (e.g., File Server, Mail Server).PrerequisiteUserRoleAttribute Informs shell whether element is to beused only in certain user roles (e.g., Domain Administrator, BackupOperator). PrerequisiteScriptAttribute Informs the shell this scriptwill be run before excuting the actual command or parameter. Can be usedfor parameter validation PrerequisiteUITypeAttribute This is used tocheck the User interface available before excuting

TABLE 2 Parsing Guideline Directives Name DescriptionParsingParameterPositionAttribute Maps unqualified parameters based onposition. ParsingVariableLengthParameterListAttribute Maps parametersnot having a Parsing ParameterPosition attribute.ParsingDisallowInteractionAttribute Specifies action when number ofparameters is less than required number.ParsingRequireInteractionAttribute Specifies that parameters areobtained through interaction. ParsingHiddenElementAttribute Makesparameter invisible to end user. ParsingMandatoryParameterAttributeSpecifies that the parameter is required.ParsingPasswordParameterAttribute Requires special handling ofparameter. ParsingPromptStringAttribute Specifies a prompt for theparameter. ParsingDefaultAnswerAttribute Specifies default answer forparameter. ParsingDefaultAnswerScriptAttribute Specifies action to getdefault answer for parameter. ParsingDefaultValueAttribute Specifiesdefault value for parameter. ParsingDefaultValueScriptAttributeSpecifies action to get default value for parameter.ParsingParameterMappingAttribute Specifies a way to group parametersParsingParameterDeclarationAttribute This defines that the filed is aparameter ParsingAllowPipelineInputAttribute Defines the parameter canbe populated from the pipeline

TABLE 3 Documentation Directives Name Description DocumentNameAttributeProvides a Name to refer to elements for interaction or help.DocumentShortDescriptionAttribute Provides brief description of element.DocumentLongDescriptionAttribute Provides detailed description ofelement. DocumentExampleAttribute Provides example of element.DocumentSeeAlsoAttribute Provides a list of related elements.DocumentSynopsisAttribute Provides documentation information forelement.

TABLE 4 Data Validation Directives Name DescriptionValidationRangeAttribute Specifies that parameter must be within certainrange. ValidationSetAttribute Specifies that parameter must be withincertain collection. ValidationPatternAttribute Specifies that parametermust fit a certain pattern. ValidationLengthAttribute Specifies thestrings must be within size range. ValidationTypeAttribute Specifiesthat parameter must be of certain type. ValidationCountAttributueSpecifies that input items must be of a certain number.ValidationFileAttribute Specifies certain properties for a file.ValidationFileAttributesAttribute Specifies certain properties for afile. ValidationFileSizeAttribute Specifies that files must be withinspecified range. ValidationNetworkAttribute Specifies that given NetworkEntity supports certain properties. ValidationScriptAttribute Specifiesconditions to evaluate before using element. ValidationMethodAttributeSpecifies conditions to evaluate before using element.

TABLE 5 Processing and Encoding Directives Name DescriptionProcessingTrimStringAttribute Specifies size limit for strings.ProcessingTrimCollectionAttribute Specifies size limit for collection.EncodingTypeCoercionAttribute Specifies Type that objects are to beencoded. ExpansionWildcardsAttribute Provides a mechanism to allowglobbing

When the exemplary administrative tool framework is operating within the.NET™ Framework, each category has a base class that is derived from abasic category class (e.g., CmdAttribute). The basic category classderives from a System.Attribute class. Each category has a pre-definedfunction (e.g., attrib.func( )) that is called by the parser duringcategory processing. The script author may create a custom category thatis derived from a custom category class (e.g., CmdCustomAttribute). Thescript author may also extend an existing category class by deriving adirective class from the base category class for that category andoverride the pre-defined function with their implementation. The scriptauthor may also override directives and add new directives to thepre-defined set of directives.

The order of processing of these directives may be stored in an externaldata store accessible by the parser. The administrative tool frameworklooks for registered categories and calls a function (e.g.,ProcessCustomDirective) for each of the directives in that category.Thus, the order of category processing may be dynamic by storing thecategory execution information in a persistent store. At differentprocessing stages, the parser checks in the persistent store todetermine if any metadata category needs to be executed at that time.This allows categories to be easily deprecated by removing the categoryentry from the persistent store.

Exemplary Processing of Command Strings

One exemplary process for processing command strings is now described.FIG. 13 is a functional flow diagram graphically illustrating theprocessing of a command string 1350 through a parser 220 and a coreengine 224 within the administrative tool framework shown in FIG. 2. Theexemplary command string 1350 pipelines several commands (i.e., processcommand 1360, where command 1362, sort command 1364, and table command1366). The command line 1350 may pass input parameters to any of thecommands (e.g., “handlecount>X 400” is passed to the where command1362). One will note that the process command 1360 does not have anyassociated input parameters.

In the past, each command was responsible for parsing the inputparameters associated with the command, determining whether the inputparameters were valid, and issuing error messages if the inputparameters were not valid. Because the commands were typically writtenby various programmers, the syntax for the input parameters on thecommand line was not very consistent. In addition, if an error occurred,the error message, even for the same error, was not very consistentbetween the commands.

For example, in a UNIX environment, an “ls” command and a “ps” commandhave many inconsistencies between them. While both accept an option“-w”, the “-w” option is used by the “ls” command to denote the width ofthe page, while the “-w” option is used by the “ps” command to denoteprint wide output (in essence, ignoring page width). The help pagesassociated with the “ls” and the “ps” command have severalinconsistencies too, such as having options bolded in one and not theother, sorting options alphabetically in one and not the other,requiring some options to have dashes and some not.

The present administrative tool framework provides a more consistentapproach and minimizes the amount of duplicative code that eachdeveloper must write. The administrative tool framework 200 provides asyntax (e.g., grammar), a corresponding semantics (e.g., a dictionary),and a reference model to enable developers to easily take advantage ofcommon functionality provided by the administrative tool framework 200.

Before describing the present invention any further, definitions foradditional terms appearing through-out this specification are provided.Input parameter refers to input-fields for a cmdlet. Argument refers toan input parameter passed to a cmdlet that is the equivalent of a singlestring in the argv array or passed as a single element in a cmdletobject. As will be described below, a cmdlet provides a mechanism forspecifying a grammar. The mechanism may be provided directly orindirectly. An argument is one of an option, an option-argument, or anoperand following the command-name. Examples of arguments are givenbased on the following command line:findstr/i/d:winnt;\winnt\system32aa*b*.ini.

In the above command line, “findstr” is argument 0, “/i” is argument 1,“/d:\winnt;\winnt\system32” is argument 2, “aa*b” is argument 3, and“*.ini” is argument 4. An “option” is an argument to a cmdlet that isgenerally used to specify changes to the program's default behavior.Continuing with the example command line above, “/i” and “/d” areoptions. An “option-argument” is an input parameter that follows certainoptions. In some cases, an option-argument is included within the sameargument string as the option. In other cases, the option-argument isincluded as the next argument. Referring again to the above commandline, “winnt;\winnt\system32” is an option-argument. An “operand” is anargument to a cmdlet that is generally used as an object supplyinginformation to a program necessary to complete program processing.Operands generally follow the options in a command line. Referring tothe example command line above again, “aa*b” and “*.ini” are operands. A“parsable stream” includes the arguments.

Referring to FIG. 13, parser 220 parses a parsable stream (e.g., commandstring 1350) into constituent parts 1320-1326 (e.g., where portion1322). Each portion 1320-1326 is associated with one of the cmdlets1330-1336. Parser 220 and engine 224 perform various processing, such asparsing, parameter validation, data generation, parameter processing,parameter encoding, and parameter documentation. Because parser 220 andengine 224 perform common functionality on the input parameters on thecommand line, the administrative tool framework 200 is able to issueconsistent error messages to users.

As one will recognize, the executable cmdlets 1330-1336 written inaccordance with the present administrative tool framework require lesscode than commands in prior administrative environments. Each executablecmdlet 1330-1336 is identified using its respective constituent part1320-1326. In addition, each executable cmdlet 1330-1336 outputs objects(represented by arrows 1340, 1342, 1344, and 1346) which are input asinput objects (represented by arrows 1341, 1343, and 1345) to the nextpipelined cmdlet. These objects may be input by passing a reference(e.g., handle) to the object. The executable cmdlets 1330-1336 may thenperform additional processing on the objects that were passed in.

FIG. 14 is a logical flow diagram illustrating in more detail theprocessing of command strings suitable for use within the process forhandling input shown in FIG. 9. The command string processing begins atblock 1401, where either the parser or the script engine identified acommand string within the input. In general the core engine performsset-up and sequencing of the data flow of the cmdlets. The set-up andsequencing for one cmdlet is described below, but is applicable to eachcmdlet in a pipeline. Processing continues at block 1404.

At block 1404, a cmdlet is identified. The identification of the cmdletmay be thru registration. The core engine determines whether the cmdletis local or remote. The cmdlet may execute in the followinglocations: 1) within the application domain of the administrative toolframework; 2) within another application domain of the same process asthe administrative tool framework; 3) within another process on the samecomputing device; or 4) within a remote computing device. Thecommunication between cmdlets operating within the same process isthrough objects. The communication between cmdlets operating withindifferent processes is through a serialized structured data format. Oneexemplary serialized structured data format is based on the extensiblemarkup language (XML). Processing continues at block 1406.

At block 1406, an instance of the cmdlet object is created. An exemplaryprocess for creating an instance of the cmdlet is described below inconjunction with FIG. 15. Once the cmdlet object is created, processingcontinues at block 1408.

At block 1408, the properties associated with the cmdlet object arepopulated. As described above, the developer declares properties withina cmdlet class or within an external source. Briefly, the administrativetool framework will decipher the incoming object(s) to the cmdletinstantiated from the cmdlet class based on the name and type that isdeclared for the property. If the types are different, the type may becoerced via the extended data type manager. As mentioned earlier, inpipelined command strings, the output of each cmdlet may be a list ofhandles to objects. The next cmdlet may inputs this list of objecthandles, performs processing, and passes another list of object handlesto the next cmdlet. In addition, as illustrated in FIG. 7, inputparameters may be specified as coming from the command line. Oneexemplary method for populating properties associated with a cmdlet isdescribed below in conjunction with FIG. 16. Once the cmdlet ispopulated, processing continues at block 1410.

At block 1410, the cmdlet is executed. In overview, the processingprovided by the cmdlet is performed at least once, which includesprocessing for each input object to the cmdlet. Thus, if the cmdlet isthe first cmdlet within a pipelined command string, the processing isexecuted once. For subsequent cmdlets, the processing is executed foreach object that is passed to the cmdlet. One exemplary method forexecuting cmdlets is described below in conjunction with FIG. 5. Whenthe input parameters are only coming from the command line, execution ofthe cmdlet uses the default methods provided by the base cmdlet case.Once the cmdlet is finished executing, processing proceeds to block1412.

At block 1412, the cmdlet is cleaned-up. This includes calling thedestructor for the associated cmdlet object which is responsible forde-allocating memory and the like. The processing of the command stringis then complete.

Exemplary Process for Creating a Cmdlet Object

FIG. 15 is a logical flow diagram illustrating an exemplary process forcreating a cmdlet object suitable for use within the processing ofcommand strings shown in FIG. 14. At this point, the cmdlet datastructure has been developed and attributes and expected inputparameters have been specified. The cmdlet has been compiled and hasbeen registered. During registration, the class name (i.e., cmdlet name)is written in the registration store and the metadata associated withthe cmdlet has been stored. The process 1500 begins at block 1501, wherethe parser has received input (e.g., keystrokes) indicating a cmdlet.The parser may recognize the input as a cmdlet by looking up the inputfrom within the registry and associating the input with one of theregistered cmdlets. Processing proceeds to block 1504.

At block 1504, metadata associated with the cmdlet object class is read.The metadata includes any of the directives associated with the cmdlet.The directives may apply to the cmdlet itself or to one or more of theparameters. During cmdlet registration, the registration code registersthe metadata into a persistent store. The metadata may be stored in anXML file in a serialized format, an external database, and the like.Similar to the processing of directives during script processing, eachcategory of directives is processed at a different stage. Each metadatadirective handles its own error handling. Processing continues at block1506.

At block 1506, a cmdlet object is instantiated based on the identifiedcmdlet class. Processing continues at block 1508.

At block 1508, information is obtained about the cmdlet. This may occurthrough reflection or other means. The information is about the expectedinput parameters. As mentioned above, the parameters that are declaredpublic (e.g., public string Name 730) correspond to expected inputparameters that can be specified in a command string on a command lineor provided in an input stream. The administrative tool frameworkthrough the extended type manager, described in FIG. 18, provides acommon interface for returning the information (on a need basis) to thecaller. Processing continues at block 1510.

At block 1510, applicability directives (e.g., Table 1) are applied. Theapplicability directives insure that the class is used in certainmachine roles and/or user roles. For example, certain cmdlets may onlybe used by Domain Administrators. If the constraint specified in one ofthe applicability directives is not met, an error occurs. Processingcontinues at block 1512.

At block 1512, metadata is used to provide intellisense. At this pointin processing, the entire command string has not yet been entered. Theadministrative tool framework, however, knows the available cmdlets.Once a cmdlet has been determined, the administrative tool frameworkknows the input parameters that are allowed by reflecting on the cmdletobject. Thus, the administrative tool framework may auto-complete thecmdlet once a disambiguating portion of the cmdlet name is provided, andthen auto-complete the input parameter once a disambiguating portion ofthe input parameter has been typed on the command line. Auto-completionmay occur as soon as the portion of the input parameter can identify oneof the input parameters unambiguously. In addition, auto-completion mayoccur on cmdlet names and operands too. Processing continues at block1514.

At block 1514, the process waits until the input parameters for thecmdlet have been entered. This may occur once the user has indicated theend of the command string, such as by hitting a return key. In a script,a new line indicates the end of the command string. This wait mayinclude obtaining additional information from the user regarding theparameters and applying other directives. When the cmdlet is one of thepipelined parameters, processing may begin immediately. Once, thenecessary command string and input parameters have been provided,processing is complete.

Exemplary Process for Populating the Cmdlet

An exemplary process for populating a cmdlet is illustrated in FIG. 16and is now described, in conjunction with FIG. 5. In one exemplaryadministrative tool framework, the core engine performs the processingto populate the parameters for the cmdlet. Processing begins at block1601 after an instance of a cmdlet has been created. Processingcontinues to block 1602.

At block 1602, a parameter (e.g., ProcessName) declared within thecmdlet is retrieved. Based on the declaration with the cmdlet, the coreengine recognizes that the incoming input objects will provide aproperty named “ProcessName”. If the type of the incoming property isdifferent than the type specified in the parameter declaration, the typewill be coerced via the extended type manager. The process of coercingdata types is explained below in the subsection entitled “ExemplaryExtended Type Manager Processing.” Processing continues to block 1603.

At block 1603, an attribute associated with the parameter is obtained.The attribute identifies whether the input source for the parameter isthe command line or whether it is from the pipeline. Processingcontinues to decision block 1604.

At decision block 1604, a determination is made whether the attributespecifies the input source as the command line. If the input source isthe command line, processing continues at block 1609. Otherwise,processing continues at decision block 1605.

At decision block 1605, a determination is made whether the propertyname specified in the declaration should be used or whether a mappingfor the property name should be used. This determination is based onwhether the command input specified a mapping for the parameter. Thefollowing line illustrates an exemplary mapping of the parameter“ProcessName” to the “foo” member of the incoming object:$ get/process|where han* -gt 500|stop/process—ProcessName<-foo.Processing continues at block 1606.

At block 1606, the mapping is applied. The mapping replaces the name ofthe expected parameter from “ProcessName” to “foo”, which is then usedby the core engine to parse the incoming objects and to identify thecorrect expected parameter. Processing continues at block 1608.

At block 1608, the extended type manager is queried to locate a valuefor the parameter within the incoming object. As explain in conjunctionwith the extended type manager, the extended type manager takes theparameter name and uses reflection to identify a parameter within theincoming object with parameter name. The extended type manager may alsoperform other processing for the parameter, if necessary. For example,the extended type manager may coerce the type of data to the expectedtype of data through a conversion mechanism described above. Processingcontinues to decision block 1610.

Referring back to block 1609, if the attribute specifies that the inputsource is the command line, data from the command line is obtained.Obtaining the data from the command line may be performed via theextended type manager. Processing then continues to decision block 1610.

At decision block 1610, a determination is made whether there is anotherexpected parameter. If there is another expected parameter, processingloops back to block 1602 and proceeds as described above. Otherwise,processing is complete and returns.

Thus, as shown, cmdlets act as a template for shredding incoming data toobtain the expected parameters. In addition, the expected parameters areobtained without knowing the type of incoming object providing the valuefor the expected parameter. This is quite different than traditionaladministrative environments. Traditional administrative environments aretightly bound and require that the type of object be known at compiletime. In addition, in traditional environments, the expected parameterwould have been passed into the function by value or by reference. Thus,the present parsing (e.g., “shredding”) mechanism allows programmers tospecify the type of parameter without requiring them to specificallyknow how the values for these parameters are obtained.

For example, given the following declaration for the cmdlet Foo: classFoo : Cmdlet {   string Name;   Bool Recurse; }

The command line syntax may be any of the following:$ Foo-Name: (string) -Recurse: True$ Foo-Name <string> -Recurse True$Foo-Name (string).

The set of rules may be modified by system administrators in order toyield a desired syntax. In addition, the parser may support multiplesets of rules, so that more than one syntax can be used by users. Inessence, the grammar associated with the cmdlet structure (e.g., stringName and Bool Recurse) drives the parser.

In general, the parsing directives describe how the parameters enteredas the command string should map to the expected parameters identifiedin the cmdlet object. The input parameter types are checked to determinewhether correct. If the input parameter types are not correct, the inputparameters may be coerced to become correct. If the input parametertypes are not correct and can not be coerced, a usage error is printed.The usage error allows the user to become aware of the correct syntaxthat is expected. The usage error may obtain information describing thesyntax from the Documentation Directives. Once the input parameter typeshave either been mapped or have been verified, the corresponding membersin the cmdlet object instance are populated. As the members arepopulated, the extended type manager provides processing of the inputparameter types. Briefly, the processing may include a property pathmechanism, a key mechanism, a compare mechanism, a conversion mechanism,a globber mechanism, a relationship mechanism, and a property setmechanism. Each of these mechanisms is described in detail below in thesection entitled “Extended Type Manager Processing”, which also includesillustrative examples.

Exemplary Process for Executing the Cmdlet

An exemplary process for executing a cmdlet is illustrated in FIG. 17and is now described. In one exemplary administrative tool environment,the core engine executes the cmdlet. As mentioned above, the code 1442within the second method 1440 is executed for each input object.Processing begins at block 1701 where the cmdlet has already beenpopulated. Processing continues at block 1702.

At block 1702, a statement from the code 542 is retrieved for execution.Processing continues at decision block 1704.

At decision block 1704, a determination is made whether a hook isincluded within the statement. Turning briefly to FIG. 5, the hook mayinclude calling an API provided by the core engine. For example,statement 550 within the code 542 of cmdlet 500 in FIG. 5 calls theconfirmprocessing API specifying the necessary parameters, a firststring (e.g., “PID=”), and a parameter (e.g., PID). Turning back to FIG.17, if the statement includes the hook, processing continues to block1712. Thus, if the instruction calling the confirmprocessing API isspecified, the cmdlet operates in an alternate executing mode that isprovided by the operating environment. Otherwise, processing continuesat block 1706 and execution continues in the “normal” mode.

At block 1706, the statement is processed. Processing then proceeds todecision block 1708. At block 1708, a determination is made whether thecode includes another statement. If there is another statement,processing loops back to block 1702 to get the next statement andproceeds as described above. Otherwise, processing continues to decisionblock 1714.

At decision block 1714, a determination is made whether there is anotherinput object to process. If there is another input object, processingcontinues to block 1716 where the cmdlet is populated with data from thenext object. The population process described in FIG. 16 is performedwith the next object. Processing then loops back to block 1702 andproceeds as described above. Once all the objects have been processed,the process for executing the cmdlet is complete and returns.

Returning back to decision block 1704, if the statement includes thehook, processing continues to block 1712. At block 1712, the additionalfeatures provided by the administrative tool environment are processed.Processing continues at decision block 1708 and continues as describedabove.

The additional processing performed within block 1712 is now describedin conjunction with the exemplary data structure 600 illustrated in FIG.6. As explained above, within the command base class 600 there may beparameters declared that correspond to additional expected inputparameters (e.g., a switch).

The switch includes a predetermined string, and when recognized, directsthe core engine to provide additional functionality to the cmdlet. Ifthe parameter verbose 610 is specified in the command input, verbosestatements 614 are executed. The following is an example of a commandline that includes the verbose switch:$ get/process|where “han* -gt 500”|stop/process -verbose.

In general, when “-verbose” is specified within the command input, thecore engine executes the command for each input object and forwards theactual command that was executed for each input object to the hostprogram for display. The following is an example of output generatedwhen the above command line is executed in the exemplary administrativetool environment:$ stop/process PID=15$ stop/process PID=33.

If the parameter whatif 620 is specified in the command input, whatifstatements 624 are executed. The following is an example of a commandline that includes the whatif switch:$ get/process|where “han* -gt 500”|stop/process -whatif.

In general, when “-whatif” is specified, the core engine does notactually execute the code 542, but rather sends the commands that wouldhave been executed to the host program for display. The following is anexample of output generated when the above command line is executed inthe administrative tool environment of the present invention:#$ stop/process PID=15#$ stop/process PID=33.

If the parameter confirm 630 is specified in the command input, confirmstatements 634 are executed. The following is an example of a commandline that includes the confirm switch:$ get/process|where “han* -gt 500”|stop/process -confirm.

In general, when “-confirm” is specified, the core engine requestsadditional user input on whether to proceed with the command or not. Thefollowing is an example of output generated when the above command lineis executed in the administrative tool environment of the presentinvention.$ stop/process PID 15Y/N Y$ stop/process PID 33Y/N N.

As described above, the exemplary data structure 600 may also include asecurity method 640 that determines whether the task being requested forexecution should be allowed. In traditional administrative environments,each command is responsible for checking whether the person executingthe command has sufficient privileges to perform the command. In orderto perform this check, extensive code is needed to access informationfrom several sources. Because of these complexities, many commands didnot perform a security check. The inventors of the presentadministrative tool environment recognized that when the task isspecified in the command input, the necessary information for performingthe security check is available within the administrative toolenvironment. Therefore, the administrative tool framework performs thesecurity check without requiring complex code from the tool developers.The security check may be performed for any cmdlet that defines the hookwithin its cmdlet. Alternatively, the hook may be an optional inputparameter that can be specified in the command input, similar to theverbose parameter described above.

The security check is implemented to support roles based authentication,which is generally defined as. a system of controlling which users haveaccess to resources based on the role of the user. Thus, each role isassigned certain access rights to different resources. A user is thenassigned to one or more roles. In general, roles based authenticationfocus on three items: principle, resource, and action. The principleidentifies who requested the action to be performed on the resource.

The inventors of the present invention recognized that the cmdlet beingrequested corresponded to the action that was to be performed. Inaddition, the inventors appreciated that the owner of the process inwhich the administrative tool framework was executing corresponded tothe principle. Further, the inventors appreciated that the resource isspecified within the cmdlet. Therefore, because the administrative toolframework has access to these items, the inventors recognized that thesecurity check could be performed from within the administrative toolframework without requiring tool developers to implement the securitycheck.

The operation of the security check may be performed any time additionalfunctionality is requested within the cmdlet by using the hook, such asthe confirmprocessing API. Alternatively, security check may beperformed by checking whether a security switch was entered on thecommand line, similar to verbose, whatif, and confirm. For eitherimplementation, the checkSecurity method calls an API provided by asecurity process (not shown) that provides a set of APIs for determiningwho is allowed. The security process takes the information provided bythe administrative tool framework and provides a result indicatingwhether the task may be completed. The administrative tool framework maythen provide an error or just stop the execution of the task.

Thus, by providing the hook within the cmdlet, the developers may useadditional processing provided by the administrative tool framework.

Exemplary Extended Type Manager Processing

As briefly mentioned above in conjunction with FIG. 18, the extendedtype manager may perform additional processing on objects that aresupplied. The additional processing may be performed at the request ofthe parser 220, the script engine 222, or the pipeline processor 402.The additional processing includes a property path mechanism, a keymechanism, a compare mechanism, a conversion mechanism, a globbermechanism, a relationship mechanism, and a property set mechanism. Thoseskilled in the art will appreciate that the extended type manager mayalso be extended with other processing without departing from the scopeof the claimed invention. Each of the additional processing mechanismsis now described.

First, the property path mechanism allows a string to navigateproperties of objects. In current reflection systems, queries may queryproperties of an object. However, in the present extended type manager,a string may be specified that will provide a navigation path tosuccessive properties of objects. The following is an illustrativesyntax for the property path: P1.P2.P3.P4.

Each component (e.g., P1, P2, P3, and P4) comprises a string that mayrepresent a property, a method with parameters, a method withoutparameters, a field, an XPATH, or the like. An XPATH specifies a querystring to search for an element (e.g., “/FOO@=13”). Within the string, aspecial character may be included to specifically indicate the type ofcomponent. If the string does not contain the special character, theextended type manager may perform a lookup to determine the type ofcomponent. For example, if component P1 is an object, the extended typemanager may query whether P2 is a property of the object, a method onthe object, a field of the object, or a property set. Once the extendedtype manager identifies the type for P2, processing according to thattype is performed. If the component is not one of the above types, theextended type manager may further query the extended sources todetermine whether there is a conversion function to convert the type ofP1 into the type of P2. These and other lookups will now be describedusing illustrative command strings and showing the respective output.

The following is an illustrative string that includes a property path:$ get/process|/where hand* -gt>500|format/table name.toupper, ws.kb,exe*.ver*.description.tolower.trunc(30).

In the above illustrative string, there are three property paths: (1)“name.toupper”; (2) “ws.kb”; and (3)“exe*.ver*.description.tolower.trunc(30). Before describing theseproperty paths, one should note that “name”, “ws”, and “exe” specify theproperties for the table. In addition, one should note that each ofthese properties is a direct property of the incoming object, originallygenerated by “get/process” and then pipelined through the variouscmdlets. Processing involved for each of the three property paths willnow be described.

In the first property path (i.e., “name.toupper”), name is a directproperty of the incoming object and is also an object itself. Theextended type manager queries the system using the priority lookupdescribed above to determine the type for toupper. The extended typemanager discovers that toupper is not a property. However, toupper maybe a method inherited by a string type to convert lower case letters toupper case letters within the string. Alternatively, the extended typemanager may have queried the extended metadata to determine whetherthere is any third party code that can convert a name object to uppercase. Upon finding the component type, processing is performed inaccordance with that component type.

In the second property path (i.e., “ws.kb”), “ws” is a direct propertyof the incoming object and is also an object itself. The extended typemanager determines that “ws” is an integer. Then, the extended typemanager queries whether kb is a property of an integer, whether kb is amethod of an integer, and finally queries whether any code knows how totake an integer and convert the integer to a kb type. Third party codeis registered to perform this conversion and the conversion isperformed.

In the third property path (i.e.,“exe*.ver*.description.tolower.trunc(30)”), there are severalcomponents. The first component (“exe*”) is a direct property of theincoming object and is also an object. Again, the extended type managerproceeds down the lookup query in order to process the second component(“ver*). The “exe* object does not have a “ver*” property or method, sothe extend type manager queries the extended metadata to determinewhether there is any code that is registered to convert an executablename into a version. For this example, such code exists. The code maytake the executable name string and use it to open a file, then accessesthe version block object, and return the description property (the thirdcomponent (“description”) of the version block object. The extended typemanager then performs this same lookup mechanism for the fourthcomponent (“tolower”) and the fifth component (“trunc(40)”). Thus, asillustrated, the extended type manager may perform quite elaborateprocessing on a command string without the administrator needing towrite any specific code. Table 1 illustrates output generated for theillustrative string. TABLE 1 Name.toupper ws.kbexe*.ver*.description.tolower.trunc(30) ETCLIENT 29,964 etclient CSRSS 6,944 SVCHOST 28,944 generic host process for win32 OUTLOOK 18,556office outlook MSMSGS 13,248 messenger

Another query mechanism 1824 includes a key. The key identifies one ormore properties that make an instance of the data type unique. Forexample, in a database, one column may be identified as the key whichcan uniquely identify each row (e.g., social security number). The keyis stored within the type metadata 1840 associated with the data type.This key may then be used by the extended type manager when processingobjects of that data type. The data type may be an extended data type oran existing data type.

Another query mechanism 1824 includes a compare mechanism. The comparemechanism compares two objects. If the two objects directly support thecompare function, the directly supported compare function is executed.However, if neither object supports a compare function, the extendedtype manager may look in the type metadata for code that has beenregistered to support the compare between the two objects. Anillustrative series of command line strings invoking the comparemechanism is shown below, along with corresponding output in Table 2.TABLE 2 $ $a = $( get/date ) $ start/sleep 5 $ $b = $( get/datecompare/time $a $b Ticks: 51196579 Days: 0 Hours: 0 Milliseconds: 119Minutes: 0 Seconds: 5 TotalDays: 5.92552997685185E−05 TotalHours:0.00142212719444444 TotalMilliseconds: 5119.6579 TotalMinutes:0.0853276316666667 TotalSeconds: 5.1196579

Compare/time cmdlet is written to compare two datetime objects. In thiscase, the DateTime object supports the IComparable interface.

Another query mechanism 1824 includes a conversion mechanism. Theextended type manager allows code to be registered stating its abilityto perform a specific conversion. Then, when an object of type A isinput and a cmdlet specifies an object of type B, the extended typemanager may perform the conversion using one of the registeredconversions. The extended type manager may perform a series ofconversions in order to coerce type A into type B. The property pathdescribed above (“ws.kb”) illustrates a conversion mechanism.

Another query mechanism 1824 includes a globber mechanism. A globberrefers to a wild card character within a string. The globber mechanisminputs the string with the wild card character and produces a set ofobjects. The extended type manager allows code to be registered thatspecifies wildcard processing. The property path described above(“exe*.ver*.description.tolower.trunc(30)) illustrates the globbermechanism. A registered process may provide globbing for file names,file objects, incoming properties, and the like.

Another query mechanism 1824 includes a property set mechanism. Theproperty set mechanism allows a name to be defined for a set ofproperties. An administrator may then specify the name within thecommand string to obtain the set of properties. The property set may bedefined in various ways. In one way, a predefined parameter, such as“?”, may be entered as an input parameter for a cmdlet. The operatingenvironment upon recognizing the predefined parameter lists all theproperties of the incoming object. The list may be a GUI that allows anadministrator to easily check (e.g., “click on”) the properties desiredand name the property set. The property set information is then storedin the extended metadata. An illustrative string invoking the propertyset mechanism is shown below, along with corresponding output in Table3:$ get/process|where han* -gt>500|format/table config.

In this illustrative string, a property set named “config” has beendefined to include a name property, a process id property (Pid), and apriority property. The output for the table is shown below. TABLE 3 NamePid Priority ETClient  3528 Normal csrss   528 Normal svchost   848Normal OUTLOOK 2,772 Normal msmsgs 2,584 Normal

Another query mechanism 1824 includes a relationship mechanism. Incontrast to traditional type systems that support one relationship(i.e., inheritance), the relationship mechanism supports expressing morethan one relationship between types. Again, these relationships areregistered. The relationship may include finding items that the objectconsumes or finding the items that consume the object. The extended typemanager may access ontologies that describe various relationships. Usingthe extended metadata and the code, a specification for accessing anyontology service, such as OWL, DAWL, and the like, may be described. Thefollowing is a portion of an illustrative string which utilizes therelationship mechanism: .OWL:“string”.

The “OWL” identifier identifies the ontology service and the “string”specifies the specific string within the ontology service. Thus, theextended type manager may access types supplied by ontology services.

Exemplary Process for Displaying Command Line Data

The present mechanism provides a data driven command line output. Theformatting and outputting of the data is provided by one or more cmdletsin the pipeline of cmdlets. Typically, these cmdlets are included withinthe non-management cmdlets described in conjunction with FIG. 2 above.The cmdlets may include a format cmdlet, a markup cmdlet, a convertcmdlet, a transform cmdlet, and an out cmdlet.

FIG. 19 graphically depicts exemplary sequences 1901-1907 of thesecmdlets within a pipeline. The first sequence 1901 illustrates the outcmdlet 1910 as the last cmdlet in the pipeline. In the same manner asdescribed above for other cmdlets, the out cmdlet 1910 accepts a streamof pipeline objects generated and processed by other cmdlets within thepipeline. However, in contrast to most cmdlets, the out cmdlet 1910 doesnot emit pipeline objects for other cmdlets. Instead, the out cmdlet1910 is responsible for rendering/displaying the results generated bythe pipeline. Each out cmdlet 1910 is associated with an outputdestination, such as a device, a program, and the like. For example, fora console device, the out cmdlet 1910 may be specified as out/console;for an internet browser, the out cmdlet 1910 may be specified asout/browser; and for a window, the out cmdlet 1910 may be specified asout/window. Each specific out cmdlet is familiar with the capabilitiesof its associated destination. Locale information (e.g., date &currencyformats) are processed by the out cmdlet 1910, unless a convert cmdletpreceded the out cmdlet in the pipeline. In this situation, the convertcmdlet processed the local information.

Each host is responsible for supporting certain out cmdlets, such asout/console. The host also supports any destination specific host cmdlet(e.g., out/chart that directs output to a chart provided by aspreadsheet application). In addition, the host is responsible forproviding default handling of results. The out cmdlet in this sequencemay decide to implement its behavior by calling other output processingcmdlets (such as format/markup/convert/transform). Thus, the out cmdletmay implicitly modify sequence 1901 to any of the other sequences or mayadd its own additional format/output cmdlets.

The second sequence 1902 illustrates a format cmdlet 1920 before the outcmdlet 1910. For this sequence, the format cmdlet 1920 accepts a streamof pipeline objects generated and processed by other cmdlets within thepipeline. In overview, the format cmdlet 1920 provides a way to selectdisplay properties and a way to specify a page layout, such as shape,column widths, headers, footers, and the like. The shape may include atable, a wide list, a columnar list, and the like. In addition, theformat cmdlet 1920 may include computations of totals or sums. Exemplaryprocessing performed by a format cmdlet 1920 is described below inconjunction with FIG. 20. Briefly, the format cmdlet emits formatobjects, in addition to emitting pipeline objects. The format objectscan be recognized downstream by an out cmdlet (e.g., out cmdlet 1920 insequence 1902) via the extended type manager or other mechanism. The outcmdlet 1920 may choose to either use the emitted format objects or maychoose to ignore them. The out cmdlet determines the page layout basedon the page layout data specified in the display information. In certaininstances, modifications to the page layout may be specified by the outcmdlet. In one exemplary process the out cmdlet may determine anunspecified column width by finding a maximum length for each propertyof a predetermined number of objects (e.g., 50) and setting the columnwidth to the maximum length. The format objects include formattinginformation, header/footer information, and the like.

The third sequence 1903 illustrates a format cmdlet 1920 before the outcmdlet 1910. However, in the third sequence 1903, a markup cmdlet 1930is pipelined between the format cmdlet 1920 and the out cmdlet 1910. Themarkup cmdlet 1930 provides a mechanism for adding property annotation(e.g., font, color) to selected parameters. Thus, the markup cmdlet 1930appears before the output cmdlet 1910. The property annotations may beimplemented using a “shadow property bag”, or by adding propertyannotations in a custom namespace in a property bag. The markup cmdlet1930 may appear before the format cmdlet 1920 as long as the markupannotations may be maintained during processing of the format cmdlet1920.

The fourth sequence 1904 again illustrates a format cmdlet 1920 beforethe out cmdlet 1910. However, in the fourth sequence 1904, a convertcmdlet 1940 is pipelined between the format cmdlet 1920 and the outcmdlet 1910. The convert cmdlet 1940 is also configured to process theformat objects emitted by the format cmdlet 1920. The convert cmdlet1940 converts the pipelined objects into a specific encoding based onthe format objects. The convert cmdlet 1940 is associated with thespecific encoding. For example, the convert cmdlet 1940 that convertsthe pipelined objects into Active Directory Objects (ADO) may bedeclared as “convert/ADO” on the command line. Likewise, the convertcmdlet 1940 that converts the pipelined objects into comma separatedvalues (csv) may be declared as “convert/csv” on the command line. Someof the convert cmdlets 1940 (e.g., convert/XML and convert/html) may beblocking commands, meaning that all the pipelined objects are receivedbefore executing the conversion. Typically, the out cmdlet 1920 maydetermine whether to use the formatting information provided by theformat objects. However, when a convert cmdlet 1920 appears before theout cmdlet 1920, the actual data conversion has already occurred beforethe out cmdlet receives the objects. Therefore, in this situation, theout cmdlet can not ignore the conversion.

The fifth sequence 1905 illustrates a format cmdlet 1920, a markupcmdlet 1930, a convert cmdlet 1940, and an out cmdlet 1910 in thatorder. Thus, this illustrates that the markup cmdlet 1930 may occurbefore the convert cmdlet 1940.

The sixth sequence 1906 illustrates a format cmdlet 1920, a specificconvert cmdlet (e.g., convert/xml cmdlet 1940′), a specific transformcmdlet (e.g., transform/xslt cmdlet 1950), and an out cmdlet 1910. Theconvert/xml cmdlet 1940′ converts the pipelined objects into an extendedmarkup language (XML) document. The transform/xslt cmdlet 1950transforms the XML document into another XML document using anExtensible Style Lanuage (XSL) style sheet. The transform process iscommonly referred to as extensible style language transformation (XSLT),in which an XSL processor reads the XML document and follows theinstructions within the XSL style sheet to create the new XML document.

The seventh sequence 1907 illustrates a format cmdlet 1920, a markupcmdlet 1930, a specific convert cmdlet (e.g., convert/xml cmdlet 1940′),a specific transform cmdlet (e.g., transform/xslt cmdlet 1950), and anout cmdlet 1910. Thus, the seventh sequence 1907 illustrates having themarkup cmdlet 1930 upstream from the convert cmdlet and transformcmdlet.

FIG. 20 illustrates exemplary processing 2000 performed by a formatcmdlet. The formatting process begins at block 2001, after the formatcmdlet has been parsed and invoked by the parser and pipeline processorin a manner described above. Processing continues at block 2002.

At block 2002, a pipeline object is received as input to the formatcmdlet. Processing continues at block 2004.

At block 2004, a query is initiated to identify a type for the pipelinedobject. This query is performed by the extended type manager asdescribed above in conjunction with FIG. 18. Once the extended typemanager has identified the type for the object, processing continues atblock 2006.

At block 2006, the identified type is looked up in display information.An exemplary format for the display information is illustrated in FIG.21 and will be described below. Processing continues at decision block2008.

At decision block 2008, a determination is made whether the identifiedtype is specified within the display information. If there is no entrywithin the display information for the identified type, processing iscomplete. Otherwise, processing continues at block 2010.

At block 2010, formatting information associated with the identifiedtype is obtained from the display information. Processing continues atblock 2012.

At block 2012, information is emitted on the pipeline. Once theinformation is emitted, the processing is complete.

Exemplary information that may be emitted is now described in furtherdetail. The information may include formatting information,header/footer information, and a group end/begin signal object. Theformatting information may include a shape, a label, numbering/bullets,column widths, character encoding type, content font properties, pagelength, group-by-property name, and the like. Each of these may haveadditional specifications associated with it. For example, the shape mayspecify whether the shape is a table, a list, or the like. Labels mayspecify whether to use column headers, list labels, or the like.Character encoding may specify ASCII, UTF-8, Unicode, and the like.Content font properties may specify the font that is applied to theproperty values that are display. A default I font property (e.g.,Courier New, 10 point) may be used if content font properties are notspecified.

The header/footer information may include a header/footer scope, fontproperties, title, subtitle, date, time, page numbering, separator, andthe like. For example, the scope may specify a document, a page, agroup, or the like. Additional properties may be specified for eitherthe header or the footer. For example, for group and document footers,the additional properties may include properties or columns to calculatea sum/total, object counts, label strings for totals and counts, and thelike.

The group end/begin signal objects are emitted when the format cmdletdetects that a group-by property has changed. When this occurs, theformat cmdlet treats the stream of pipeline objects as previously sortedand does not re-sort them. The group end/begin signal objects may beinterspersed with the pipeline objects. Multiple group-by properties maybe specified for nested sorting. The format cmdlet may also emit aformat end object that includes final sums and totals.

Turning briefly to FIG. 21, an exemplary display information 2100 is ina structured format and contains information (e.g., formattinginformation, header/footer information, group-by properties or methods)associated with each object that has been defined. For example, thedisplay information 2100 may be XML-based. Each of the afore-mentionedproperties may then be specified within the display information. Theinformation within the display information 2100 may be populated by theowner of the object type that is being entered. The operatingenvironment provides certain APIs and cmdlets that allow the owner toupdate the display information by creating, deleting, and modifyingentries.

FIG. 22 is a table listing an exemplary syntax 2201-2213 for certainformat cmdlets (e., format/table, format/list, and format/wide), markupcmdlets (e.g., add/markup), convert cmdlets (e.g., convert/text,convert/sv, convert/csv, convert/ADO, convert/XML, convert/html),transform cmdlets (e.g., transform/XSLT) and out cmdlets (e.g.,out/console, out/file), FIG. 23 illustrates results rendered by theout/console cmdlet using various pipeline sequences of the outputprocessing cmdlets (e.g., format cmdlets, convert cmdlets, and markupcmdlets).

As described, the mechanism for obtaining and applying constraints in aninteractive environment may be employed in an administrative toolenvironment. However, those skilled in the art will appreciate that themechanism may be employed in various interactive environments.

Although details of specific implementations and embodiments aredescribed above, such details are intended to satisfy statutorydisclosure obligations rather than to limit the scope of the followingclaims. Thus, the invention as defined by the claims is not limited tothe specific features described above. Rather, the invention is claimedin any of its forms or modifications that fall within the proper scopeof the appended claims, appropriately interpreted in accordance with thedoctrine of equivalents.

1. A computer readable medium having computer-executable instructions,the instructions comprising: receiving a string in an interactiveenvironment; identifying an attribution within the string; identifying aconstruct associated with the attribution; and saving information thatcorrelates the attribution with the construct.
 2. The computer readablemedium of claim 1, wherein the attribution specifies a constraint forthe construct.
 3. The computer readable medium of claim 1, wherein theconstruct comprises a variable, a structure, a function, or a script. 4.The computer readable medium of claim 1, wherein the informationcomprises metadata.
 5. The computer readable medium of claim 1, furthercomprising applying the attribution to the construct when the constructis encountered interactively.
 6. The computer readable medium of claim1, wherein the string comprises a command string entered in a commandline environment.
 7. The computer readable medium of claim 1, whereinthe string comprises a portion of a script.
 8. The computer readablemedium of claim 1, wherein identifying the attribution comprisesidentifying a plurality of attributions associated with the construct.9. The computer readable medium of claim 1, wherein the attributionspecifies a type for the construct.
 10. The computer readable medium ofclaim 1, wherein the attribution specifies applying intellisense to theconstruct to auto-complete the construct.
 11. The computer readablemedium of claim 1, wherein the attribution specifies applying apredicate directive to the string that is operative to determine whetherprocessing of the string continues.
 12. The computer readable medium ofclaim 1, wherein the attribution specifies applying a parsing directivethat is operative to direct a manner. for obtaining the construct. 13.The computer readable medium of claim 1, wherein the attributionspecifies a data generation directive that is operative to generate aset. of information that is stored in the construct.
 14. The computerreadable medium of claim 1, wherein the attribution specifies a datavalidation directive that is operative to determine whether a valueassigned to the construct meets a criterion specified by theattribution.
 15. A method for handling constraints specified within aninteractive environment, the method comprising: identifying apre-defined begin symbol and end symbol within a string entered in aninteractive environment; identifying a constraint name between the beginsymbol and the end symbol; and identifying a construct following the endsymbol.
 16. The method of claim 15, further comprising applying theconstraint to the construct whenever the construct is encountered withinthe interactive environment.
 17. The method of claim 16, wherein theconstraint comprises a predicate directive and applying the constraintcomprises determining whether a condition has been met before continuingprocessing of the construct.
 18. The computer readable medium of claim16, wherein the attribution specifies applying intellisense to theconstruct to auto-complete the construct.
 19. The computer readablemedium of claim 16, wherein the attribution specifies applying a parsingdirective that is operative to direct a manner for obtaining theconstruct.
 20. The computer readable medium of claim 16, wherein theattribution specifies a data generation directive that is operative togenerate a set of information that is stored in the construct.
 21. Thecomputer readable medium of claim 16, wherein the attribution specifiesa data validation directive that is operative to determine whether avalue assigned to the construct meets a criterion specified by theattribution.
 22. The method of claim 15, wherein the begin symbolcomprises a left bracket and the end symbol comprises a right bracket.23. A system the handles input parameters, the system comprising: ameans for processing; and a memory means, the memory means beingallocated for a plurality of computer-executable instructions which areloaded into the memory means for execution by the means for processing,the computer-executable instructions performing a method comprising: ameans for receiving a string in an interactive environment; a means foridentifying an attribution within the string; a means for identifying aconstruct associated with the attribution; and a means for savinginformation that correlates the attribution with the construct.
 24. Thesystem of claim 23, further comprising a means for applying theattribution to the construct when the construct is encounteredinteractively.